<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<html>
<head>
	<title>Pet Manage</title>
	<jsp:include page="../layout/_import.jsp"></jsp:include>
	<style>
		a[class^='btn'] {
			cursor: pointer;
			color: #ffffff !important;
		}

		a
	</style>
</head>
<body>
<jsp:include page="../layout/_nav.jsp"></jsp:include>
<div class="container">
	<h2>宠物管理</h2>
	<form action="/petmanage" method="post">
		<input type="hidden" name="m" value="search">
		<div class="row">
			<label  class="my-1 mr-2 " for="customerName" style="margin-left: 17px;">用户姓名</label>
			<div class="col col-md-6">
				<input type="text" class="form-control" name="customerName" id="customerName">
			</div>
			<div class="col col-md-4">
				<input type="submit" class="btn btn-primary" value="查询"/>
				<a href="/petmanage" class="btn btn-primary">显示所有</a>
			</div>
		</div>
		<div class="row">
			<label  class="my-1 mr-2 " for="petName" style="margin-left: 17px;">宠物姓名</label>
			<div class="col col-md-6">
				<input type="text" class="form-control" name="petName" id="petName">
		</div>
		</div>
	</form>
	<div>
		<a href="/petmanage?m=add" class="btn btn-primary">添加宠物</a>
	</div>

	<div class="row">

		<c:forEach items="${pets}" var="p">
			<div class="col-sm-12 col-md-6 col-lg-4 py-3 px-lg-5 ">
				<div class="card" style="width: 100%;">
					<img src="${p.photo}" class="card-img-top" alt="图片加载失败">
					<div class="card-body">
						<h5 class="card-title">${p.name}</h5>
						<p class="card-text">
							<a href="" style="color: #000">主人：${p.owner.name}</a>
						</p>
						<p class="card-text">
							生日：${p.birthdate}
						</p>
						<a href="/petmanage?m=detail&id=${p.id}" class="btn btn-secondary">查看明细</a>
						<a href="/petmanage?m=edit&id=${p.id}" class="btn btn-primary">编辑</a>
						<a href="/petmanage?m=del&id=${p.id}" class="btn btn-danger">删除</a>
					</div>
				</div>
			</div>
		</c:forEach>
	</div>
</div>
</body>
</html>
